pub(crate) mod hellow {
    use crate::types::common_resp::common_resp::{Page, RequestResult,RequestResultPage};
    use crate::common::common::common::Person;
    use actix_web::{web, HttpResponse, Responder};


    async fn index() -> impl Responder {
        HttpResponse::Ok().body("Hello world!")
    }

    pub(crate) async fn manual_hello() -> impl Responder {
        let myperson = Person{ name: "Alice".to_string(), age: 30 };
        let rt =RequestResult{code:0, message:"ok".to_string(), data: myperson};
        HttpResponse::Ok().json(rt)
    }


    async fn indexop() -> impl Responder{
        let myperson = Person{ name: "Alice".to_string(), age: 30 };
        let page = Page{
            list: myperson,
            page: 1,
            size: 10,
            total: 2,
        };
        
        let rt = RequestResultPage{
            code: 0,
            message: "ok".to_string(),
            data: Some(page),
        };
        
        HttpResponse::Ok().json(rt)
    }


    // // 配置函数，用于注册路由
    // pub fn configure(cfg: &mut web::ServiceConfig) {
    //     cfg.service(web::scope("/users").route("/index", web::get().to(hello)));
    //     cfg.service(web::scope("/users").route("/echo", web::post().to(manual_hello)));
    // }

    pub fn config_routes(cfg: &mut web::ServiceConfig) {
        cfg.route("/hellow/index", web::get().to(index));
        cfg.route("/hellow/hello", web::post().to(manual_hello));
        cfg.route("/hellow/indexop", web::post().to(indexop));
    }
}